// HSS.Forms.WizardPanel.cs
// ----------------------------------------------------------------------------
// Licensed under the MIT license
// http://www.opensource.org/licenses/mit-license.html
// ----------------------------------------------------------------------------
// HighSpeed-Solutions, LLC
// Copyright (c) 2001-2010
// ----------------------------------------------------------------------------
// File:       WizardPanel.cs
// Author:     HSS\gbanta
// Created:    08/12/2010
// Modified:   12/04/2010
// ----------------------------------------------------------------------------
namespace HSS.Forms
{
	#region Using Directives
	using System.ComponentModel;
	using System.Drawing;
	using System.Windows.Forms;
	#endregion

	/// <summary>
	/// A Wizard Panel
	/// </summary>
	[ToolboxItem(false)]
	public class WizardPanel : UserControl
	{
		private string _caption;
		private bool _needsToInvalidate;
		private WizardPanel _nextPanel;
		private WizardForm _parentWizard;

		/// <summary>
		/// ctor
		/// </summary>
		public WizardPanel()
		{
			base.Size = new Size(0x220, 0x112);
		}
		/// <summary>
		/// OnComplete
		/// </summary>
		protected internal virtual void OnComplete()
		{
		}

		/// <summary>
		/// On Next Logic
		/// </summary>
		/// <returns>true</returns>
		public virtual bool OnNext()
		{
			return true;
		}
		/// <summary>
		/// On Previous Logic
		/// </summary>
		public virtual void OnPrevious()
		{
		}

		internal void SetParentWizard(WizardForm parent)
		{
			this._parentWizard = parent;
			if ((this._parentWizard != null) && this._needsToInvalidate)
			{
				this._parentWizard.Invalidate();
				this._needsToInvalidate = false;
			}
		}
		/// <summary>
		/// Gets the Caption
		/// </summary>
		public string Caption
		{
			get
			{
				if (this._caption == null)
				{
					return string.Empty;
				}
				return this._caption;
			}
			set
			{
				this._caption = value;
				if (this._parentWizard != null)
				{
					this._parentWizard.Invalidate();
				}
				else
				{
					this._needsToInvalidate = true;
				}
			}
		}

		/// <summary>
		/// Gets the Next Panel
		/// </summary>
		public WizardPanel NextPanel
		{
			get
			{
				return this._nextPanel;
			}
			set
			{
				this._nextPanel = value;
				if (this._parentWizard != null)
				{
					this._parentWizard.RegisterPanel(this._nextPanel);
				}
			}
		}

		/// <summary>
		/// Gets the parent Wizard Form
		/// </summary>
		[Browsable(false)]
		public WizardForm ParentWizard
		{
			get
			{
				return this._parentWizard;
			}
		}
	}
}